fix: allow adaptive thinking and xhigh effort with Claude Opus 4.7#9281
fix: allow adaptive thinking and xhigh effort with Claude Opus 4.7#9281Raptors65 wants to merge 9 commits into
Conversation
b1c73dc to
184d306
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 184d306a47
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } else if is_adaptive_model { | ||
| ThinkingType::Adaptive | ||
| } else if std::env::var("CLAUDE_THINKING_ENABLED").is_ok() { |
There was a problem hiding this comment.
Leave Opus 4.7 thinking disabled unless user enables it
This branch now defaults every adaptive-capable model to ThinkingType::Adaptive, which means claude-opus-4-7 requests get thinking turned on even when users did not configure any thinking mode. For Opus 4.7, that changes baseline behavior from "no thinking unless explicitly requested" to "always adaptive thinking", which can materially increase latency/token usage and alter response shape for existing users who only changed model IDs.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
this is already what we do for other models that support adaptive thinking (Sonnet 4.6 / Opus 4.6), so seems to make sense to do that for Opus 4.7 too
| if is_claude_opus_47(model_name) { | ||
| ThinkingEffort::XHigh | ||
| } else { |
There was a problem hiding this comment.
Keep Opus 4.7 effort at API default unless configured
Setting Opus 4.7's implicit effort to xhigh forces a more expensive effort tier whenever users don't explicitly set CLAUDE_THINKING_EFFORT/effort. Since thinking_effort() uses this as the fallback, existing configurations that rely on defaults will silently run at higher cost/latency than the provider default. xhigh should be an explicit opt-in, not the fallback.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
xhigh is the recommended default in the Claude docs for "coding and agentic work", which seems like the most likely kind of work someone would be using goose for, but open to having the default stay at high if we want to do that (high is the API default)
|
Observed: |
184d306 to
29ad7a3
Compare
Use adaptive thinking when preserved Anthropic thinking context needs to synthesize a thinking config for adaptive Claude models. This keeps Opus 4.7 out of the fixed-budget path while preserving prior thinking blocks across continuation requests. Signed-off-by: jh-block <jhugo@block.xyz>
Use the Anthropic API default effort when no unified thinking effort is configured. Explicit max still maps to xhigh for Opus 4.7, but an omitted effort now stays at high and is covered by a regression test. Signed-off-by: jh-block <jhugo@block.xyz>
Preserve an unset unified thinking effort through provider formatting and the model switcher. Providers now only serialize effort fields when the user or legacy config explicitly sets an effort, allowing upstream API defaults to apply. Signed-off-by: jh-block <jhugo@block.xyz>
Keep provider request formatting from inventing a thinking effort when none is configured, while making the desktop and CLI model-selection surfaces default explicit thinking effort to high for reasoning-capable models. Signed-off-by: jh-block <jhugo@block.xyz>
29ad7a3 to
0638379
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0638379368
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: jh-block <jhugo@block.xyz>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 12d93afa06
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: jh-block <jhugo@block.xyz>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 65cda3c96c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: jh-block <jhugo@block.xyz>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fecbe0c81b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: jh-block <jhugo@block.xyz>

Summary
Claude Opus 4.7 has a few breaking changes with the Claude API: https://platform.claude.com/docs/en/about-claude/models/migration-guide
Currently, for Opus 4.7 with the Anthropic provider:
thinking.display = "summarized", which means we use default behavior which in Opus 4.7 was changed to be to not emit reasoning at allThis PR fixes this by:
xhighas an effort level only for Opus 4.7, and making this the default for Opus 4.7 (this is the recommended default in the Claude docs)thinking.display = "summarized"for all models with adaptive thinking (not technically needed for Sonnet 4.6 and Opus 4.6, but would rather be explicit there too)Testing
There are some unit tests, but also tested this manually.
CLI ("adaptive" instead of "enabled" mode displayed, xhigh effort available):
Opus.4.7.CLI.mov
Desktop app:
Screen.Recording.2026-05-16.at.1.06.21.PM.mov
Summarized thinking being displayed with Opus 4.7:
Related Issues
N/A
Screenshots/Demos (for UX changes)
Before:
After: